package com.exchange.web.comment.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.exchange.web.comment.entity.comment;
import com.exchange.web.comment.entity.vo.CommentVO;
import com.exchange.web.comment.mapper.CommentMapper;
import com.exchange.web.comment.service.CommentService;
import com.exchange.web.goods.entity.vo.goodsVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author G511677
 * @Description TODO
 * @Date 1/6/2024 下午11:36
 * @Version 1.0
 */
@Service
public class CommentServiceImpl extends ServiceImpl<CommentMapper, comment> implements CommentService {

    @Autowired
    private CommentMapper commentMapper;

    @Override
    public List<CommentVO> getGoodsComment(Long goodsId) {
        List<CommentVO> commentVOS = commentMapper.getGoodsComment(goodsId);
        return commentVOS;
    }

    @Override
    public List<CommentVO> getGoodsComment_(Long goodsId, int currentPage, int pageSize) {
        IPage<CommentVO> page = new Page<>(currentPage, pageSize);
        return baseMapper.getGoodsComment_(page, goodsId);
    }
}
